package com.lxq.LeetCode.MyQueue;

import java.util.Stack;

class MyQueue {
    private Stack<Integer> Queue;
    private Stack<Integer> Stack;

    public MyQueue() {
        Queue = new Stack<>();
        Stack = new Stack<>();
    }

    public void push(int x) {
        Stack.push(x);
    }

    public int pop() {
        if (Queue.isEmpty()) {
            while (!Stack.isEmpty()) {
                Queue.push(Stack.pop());
            }
        }
        return Queue.pop();
    }

    public int peek() {
        if (Queue.isEmpty()) {
            while (!Stack.isEmpty()) {
                Queue.push(Stack.pop());
            }
        }
        return Queue.peek();
    }

    public boolean empty() {
        return Queue.isEmpty() && Stack.isEmpty();
    }
}

public class Solution {
    public static void main(String[] args) {
        MyQueue obj = new MyQueue();
        obj.push(1);
        int param_2 = obj.pop();
        int param_3 = obj.peek();
        boolean param_4 = obj.empty();
    }
}
